package com.epoint.mobileoa.ui.wsgw.task;

import java.util.Map;

import android.os.Message;

import com.epoint.mobileoa.R;
import com.epoint.mobileoa.bizlogic.NewTask;
import com.epoint.mobileoa.bizlogic.SuperView;
import com.epoint.mobileoa.tools.WebServiceUtilDAL;

/**
 * @author liyc
 * @time 2012-12-21 下午3:09:48
 * @annotation 
 */
public class PostOpinionTask extends NewTask {

	/**
	 * @param sv
	 * @param taskID
	 * @param param
	 * @param progressMsg
	 * @param progressDialogType
	 */
	public PostOpinionTask(SuperView sv, int taskID, Map<String, Object> param,
			String progressMsg, int progressDialogType) {
		super(sv, taskID, param, progressMsg, progressDialogType);
	}

	@Override
	public void exectue(Message mess) throws Exception {
		String MessageItemGuid = getParam().get("MessageItemGuid").toString();
		String NextStepGuid = getParam().get("NextStepGuid").toString();
		String NextPersonGuid = getParam().get("NextPersonGuid").toString();
		String Opinion = getParam().get("Opinion").toString();
		
		String url = sv.getString(R.string.gw_ws_url);
		String namespace = sv.getString(R.string.WS_namespace);
		String method = "Handle_PostAuditOpinion";
		WebServiceUtilDAL webservice = new WebServiceUtilDAL(url,
				method, namespace);
		
		String ParasXml = "<?xml version=\"1.0\" encoding=\"gb2312\"?>"+
				"<paras>"+
				"<UserGuid>%s</UserGuid>"+
				"<MessageItemGuid>%s</MessageItemGuid>"+
				"<NextPersonGuid>%s</NextPersonGuid>"+
				"<NextStepGuid>%s</NextStepGuid>"+
				"<PDFContent>%s</PDFContent>"+
				"<Opinion>%s</Opinion>"+
				"</paras>";
		ParasXml = String.format(ParasXml,fp.getUserguid(),MessageItemGuid,NextPersonGuid,NextStepGuid,"",Opinion);
		webservice.addProperty("ValidateData", sv.getString(R.string.WS_ValidateData));
		webservice.addProperty("ParasXml", ParasXml);
		String bs = webservice.start();
		setMessageToRefreshUI(mess, bs);
	}

}
